package com.store.controller;

import com.store.domain.R;
import com.store.domain.dto.BookDto;
import com.store.service.BookService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author yu
 * @date 2024/6/26
 */
@RestController
@RequestMapping("book")
public class BookController {
    @Resource
    private BookService bookService;
    @GetMapping("{bookId}")
    public R getBookById(@PathVariable Integer bookId){
        return bookService.getBookById(bookId);
    }
    /**
     * 热门推荐
     */
    @GetMapping("showBooks")
    public R showBooks(){
        return bookService.showBooks();
    }

    @GetMapping("searchBook")
    public R searchBook(String query){
        return bookService.searchBook(query);
    }
}
